<?php
ini_set('memory_limit', '1024M');
include_once __DIR__ . '/../BaseShell.php';
while(true){
    $task = Lib_Redis_List::rPop('MEDIATION_API_PUSH');
    if(!$task){
        sleep(1);
        continue;
    }
    $data = json_decode($task, true);
    //业务处理的类名和方法名
    $class_name = empty($data['type']) ? 'Module_Task_Case' : $data['type'];
    $method_name = $data['method'] . 'Handler';
    if(!method_exists($class_name,$method_name)){
        Func_Log::write('Handle','outQueueError_'.$task['ssid'],$class_name.'['.$method_name.']_not_exist');
        continue;
    }

    $res = call_user_func(array($class_name, $method_name), $data);
    Func_Log::write('Handle','outQueueSuccess','ssid: '.$task['ssid'].' data: '.json_encode($data) .' task_res: ' . json_encode($res));
}
